package work20241207_chap8.k;

/**
 * @author zdl
 * @date 2024/12/7
 */
interface IA{
    void ma(IB ib);
}
interface IB{
    void mb();
}
class IAImpl implements IA{
    public void ma(IB ib){
        System.out.println("“ma in IAImpl”");
        ib.mb();
    }
}
class IBImpl implements IB{
    private IA ia;
    public void setIa(IA ia){
        this.ia = ia;
    }
    public void mb(){
        System.out.println("“mb in IBImpl”");
    }
    public void method(){
        ia.ma(this);
    }
}
public class TestMain{
    public static void main(String args[]){
        IA ia = new IAImpl();
        IBImpl ib = new IBImpl();
        ib.setIa(ia);
        ib.method();//ma in IAImpl  mb in IBImpl
    }
}
